function MyError() {
    throw 'test error.';
}

test('toThrow',()=>{
    expect(MyError).toThrow();
});

test('toThrow-错误信息',()=>{
    expect(MyError).toThrow('test error.');
});

test('toThrow-正则匹配错误信息',()=>{
    expect(MyError).toThrow(/test/);
});


